import requests

server_url = 'http://0.0.0.0:8080/core/gps_device/'


def add_gps_device():
    data = {'name': 'cui1', 'code':'12', 'phone_num':123,
            'plate_num': 'jb1', 'sim_num':12, 'department':1
            }
    url = server_url + 'add/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())


def edit_gps_device():
    data = {'name': 'cui2', 'code': '13', 'phone_num': 1232,
            'plate_num': 'jb1', 'sim_num': 121, 'department': 1,
            'id':1
            }
    url = server_url + 'edit/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())


def del_gps_device():
    data = {'id': 1}
    url = server_url + 'del/'
    headers = {'Content-Type': 'application/json'}
    r = requests.post(url, json=data, headers=headers)
    print(r.json())


# add_gps_device()
# edit_gps_device()
del_gps_device()